
const objMap = {
    a:'1',
    b:2,
    c:true,
} as const;


function getKey<T extends Record<string,unknown>,K extends keyof T>(obj:T,key:K):T[K] {
    return obj[key];
}

console.log(getKey(objMap,'a'),typeof getKey(objMap,'a'));
console.log(getKey(objMap,'b'),typeof getKey(objMap,'b'));
console.log(getKey(objMap,'c'),typeof getKey(objMap,'c'));
getKey(objMap,'b');



